home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 January / enter-2004-01.iso / files / maxima-5.9.0.exe / {app} / lib / gcc-lib / mingw32 / 3.2 / include / stddef.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-02-09  |  11.3 KB  |  390 lines

  1. /* Copyright (C) 1989, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
  2.  
  3. This file is part of GNU CC.
  4.  
  5. GNU CC is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9.  
  10. GNU CC is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with GNU CC; see the file COPYING.  If not, write to
  17. the Free Software Foundation, 59 Temple Place - Suite 330,
  18. Boston, MA 02111-1307, USA.  */
  19.  
  20. /* As a special exception, if you include this header file into source
  21.    files compiled by GCC, this header file does not by itself cause
  22.    the resulting executable to be covered by the GNU General Public
  23.    License.  This exception does not however invalidate any other
  24.    reasons why the executable file might be covered by the GNU General
  25.    Public License.  */
  26.  
  27. /*
  28.  * ISO C Standard:  7.17  Common definitions  <stddef.h>
  29.  */
  30. #if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \
  31.      && !defined(__STDDEF_H__)) \
  32.     || defined(__need_wchar_t) || defined(__need_size_t) \
  33.     || defined(__need_ptrdiff_t) || defined(__need_NULL) \
  34.     || defined(__need_wint_t)
  35.  
  36. #ifndef RC_INVOKED
  37.  
  38. /* Any one of these symbols __need_* means that GNU libc
  39.    wants us just to define one data type.  So don't define
  40.    the symbols that indicate this file's entire job has been done.  */
  41. #if (!defined(__need_wchar_t) && !defined(__need_size_t)    \
  42.      && !defined(__need_ptrdiff_t) && !defined(__need_NULL)    \
  43.      && !defined(__need_wint_t))
  44. #define _STDDEF_H
  45. #define _STDDEF_H_
  46. /* snaroff@next.com says the NeXT needs this.  */
  47. #define _ANSI_STDDEF_H
  48. /* Irix 5.1 needs this.  */
  49. #define __STDDEF_H__
  50. #endif
  51.  
  52. #ifndef __sys_stdtypes_h
  53. /* This avoids lossage on SunOS but only if stdtypes.h comes first.
  54.    There's no way to win with the other order!  Sun lossage.  */
  55.  
  56. /* On 4.3bsd-net2, make sure ansi.h is included, so we have
  57.    one less case to deal with in the following.  */
  58. #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
  59. #include <machine/ansi.h>
  60. #endif
  61.  
  62. /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
  63.    defined if the corresponding type is *not* defined.
  64.    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
  65. #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
  66. #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
  67. #define _SIZE_T
  68. #endif
  69. #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
  70. #define _PTRDIFF_T
  71. #endif
  72. /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
  73.    instead of _WCHAR_T_. */
  74. #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
  75. #ifndef _BSD_WCHAR_T_
  76. #define _WCHAR_T
  77. #endif
  78. #endif
  79. /* Undef _FOO_T_ if we are supposed to define foo_t.  */
  80. #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
  81. #undef _PTRDIFF_T_
  82. #undef _BSD_PTRDIFF_T_
  83. #endif
  84. #if defined (__need_size_t) || defined (_STDDEF_H_)
  85. #undef _SIZE_T_
  86. #undef _BSD_SIZE_T_
  87. #endif
  88. #if defined (__need_wchar_t) || defined (_STDDEF_H_)
  89. #undef _WCHAR_T_
  90. #undef _BSD_WCHAR_T_
  91. #endif
  92. #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
  93.  
  94. /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
  95.    Just ignore it.  */
  96. #if defined (__sequent__) && defined (_PTRDIFF_T_)
  97. #undef _PTRDIFF_T_
  98. #endif
  99.  
  100. /* On VxWorks, <type/vxTypesBase.h> may have defined macros like
  101.    _TYPE_size_t which will typedef size_t.  fixincludes patched the
  102.    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
  103.    not defined, and so that defining this macro defines _GCC_SIZE_T.
  104.    If we find that the macros are still defined at this point, we must
  105.    invoke them so that the type is defined as expected.  */
  106. #if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
  107. _TYPE_ptrdiff_t;
  108. #undef _TYPE_ptrdiff_t
  109. #endif
  110. #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
  111. _TYPE_size_t;
  112. #undef _TYPE_size_t
  113. #endif
  114. #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
  115. _TYPE_wchar_t;
  116. #undef _TYPE_wchar_t
  117. #endif
  118.  
  119. /* In case nobody has defined these types, but we aren't running under
  120.    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
  121.    __WCHAR_TYPE__ have reasonable values.  This can happen if the
  122.    parts of GCC is compiled by an older compiler, that actually
  123.    include gstddef.h, such as collect2.  */
  124.  
  125. /* Signed type of difference of two pointers.  */
  126.  
  127. /* Define this type if we are doing the whole job,
  128.    or if we want this type in particular.  */
  129. #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
  130. #ifndef _PTRDIFF_T    /* in case <sys/types.h> has defined it. */
  131. #ifndef _T_PTRDIFF_
  132. #ifndef _T_PTRDIFF
  133. #ifndef __PTRDIFF_T
  134. #ifndef _PTRDIFF_T_
  135. #ifndef _BSD_PTRDIFF_T_
  136. #ifndef ___int_ptrdiff_t_h
  137. #ifndef _GCC_PTRDIFF_T
  138. #define _PTRDIFF_T
  139. #define _T_PTRDIFF_
  140. #define _T_PTRDIFF
  141. #define __PTRDIFF_T
  142. #define _PTRDIFF_T_
  143. #define _BSD_PTRDIFF_T_
  144. #define ___int_ptrdiff_t_h
  145. #define _GCC_PTRDIFF_T
  146. #ifndef __PTRDIFF_TYPE__
  147. #define __PTRDIFF_TYPE__ long int
  148. #endif
  149. typedef __PTRDIFF_TYPE__ ptrdiff_t;
  150. #endif /* _GCC_PTRDIFF_T */
  151. #endif /* ___int_ptrdiff_t_h */
  152. #endif /* _BSD_PTRDIFF_T_ */
  153. #endif /* _PTRDIFF_T_ */
  154. #endif /* __PTRDIFF_T */
  155. #endif /* _T_PTRDIFF */
  156. #endif /* _T_PTRDIFF_ */
  157. #endif /* _PTRDIFF_T */
  158.  
  159. /* If this symbol has done its job, get rid of it.  */
  160. #undef    __need_ptrdiff_t
  161.  
  162. #endif /* _STDDEF_H or __need_ptrdiff_t.  */
  163.  
  164. /* Unsigned type of `sizeof' something.  */
  165.  
  166. /* Define this type if we are doing the whole job,
  167.    or if we want this type in particular.  */
  168. #if defined (_STDDEF_H) || defined (__need_size_t)
  169. #ifndef __size_t__    /* BeOS */
  170. #ifndef __SIZE_T__    /* Cray Unicos/Mk */
  171. #ifndef _SIZE_T    /* in case <sys/types.h> has defined it. */
  172. #ifndef _SYS_SIZE_T_H
  173. #ifndef _T_SIZE_
  174. #ifndef _T_SIZE
  175. #ifndef __SIZE_T
  176. #ifndef _SIZE_T_
  177. #ifndef _BSD_SIZE_T_
  178. #ifndef _SIZE_T_DEFINED_
  179. #ifndef _SIZE_T_DEFINED
  180. #ifndef ___int_size_t_h
  181. #ifndef _GCC_SIZE_T
  182. #ifndef _SIZET_
  183. #ifndef __size_t
  184. #define __size_t__    /* BeOS */
  185. #define __SIZE_T__    /* Cray Unicos/Mk */
  186. #define _SIZE_T
  187. #define _SYS_SIZE_T_H
  188. #define _T_SIZE_
  189. #define _T_SIZE
  190. #define __SIZE_T
  191. #define _SIZE_T_
  192. #define _BSD_SIZE_T_
  193. #define _SIZE_T_DEFINED_
  194. #define _SIZE_T_DEFINED
  195. #define ___int_size_t_h
  196. #define _GCC_SIZE_T
  197. #define _SIZET_
  198. #define __size_t
  199. #ifndef __SIZE_TYPE__
  200. #define __SIZE_TYPE__ long unsigned int
  201. #endif
  202. #if !(defined (__GNUG__) && defined (size_t))
  203. typedef __SIZE_TYPE__ size_t;
  204. #ifdef __BEOS__
  205. typedef long ssize_t;
  206. #endif /* __BEOS__ */
  207. #endif /* !(defined (__GNUG__) && defined (size_t)) */
  208. #endif /* __size_t */
  209. #endif /* _SIZET_ */
  210. #endif /* _GCC_SIZE_T */
  211. #endif /* ___int_size_t_h */
  212. #endif /* _SIZE_T_DEFINED */
  213. #endif /* _SIZE_T_DEFINED_ */
  214. #endif /* _BSD_SIZE_T_ */
  215. #endif /* _SIZE_T_ */
  216. #endif /* __SIZE_T */
  217. #endif /* _T_SIZE */
  218. #endif /* _T_SIZE_ */
  219. #endif /* _SYS_SIZE_T_H */
  220. #endif /* _SIZE_T */
  221. #endif /* __SIZE_T__ */
  222. #endif /* __size_t__ */
  223. #undef    __need_size_t
  224. #endif /* _STDDEF_H or __need_size_t.  */
  225.  
  226.  
  227. /* Wide character type.
  228.    Locale-writers should change this as necessary to
  229.    be big enough to hold unique values not between 0 and 127,
  230.    and not (wchar_t) -1, for each defined multibyte character.  */
  231.  
  232. /* Define this type if we are doing the whole job,
  233.    or if we want this type in particular.  */
  234. #if defined (_STDDEF_H) || defined (__need_wchar_t)
  235. #ifndef __wchar_t__    /* BeOS */
  236. #ifndef __WCHAR_T__    /* Cray Unicos/Mk */
  237. #ifndef _WCHAR_T
  238. #ifndef _T_WCHAR_
  239. #ifndef _T_WCHAR
  240. #ifndef __WCHAR_T
  241. #ifndef _WCHAR_T_
  242. #ifndef _BSD_WCHAR_T_
  243. #ifndef _BSD_WCHAR_T_DEFINED_    /* Darwin */
  244. #ifndef _WCHAR_T_DEFINED_
  245. #ifndef _WCHAR_T_DEFINED
  246. #ifndef _WCHAR_T_H
  247. #ifndef ___int_wchar_t_h
  248. #ifndef __INT_WCHAR_T_H
  249. #ifndef _GCC_WCHAR_T
  250. #define __wchar_t__    /* BeOS */
  251. #define __WCHAR_T__    /* Cray Unicos/Mk */
  252. #define _WCHAR_T
  253. #define _T_WCHAR_
  254. #define _T_WCHAR
  255. #define __WCHAR_T
  256. #define _WCHAR_T_
  257. #define _BSD_WCHAR_T_
  258. #define _WCHAR_T_DEFINED_
  259. #define _WCHAR_T_DEFINED
  260. #define _WCHAR_T_H
  261. #define ___int_wchar_t_h
  262. #define __INT_WCHAR_T_H
  263. #define _GCC_WCHAR_T
  264.  
  265. /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
  266.    instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
  267.    symbols in the _FOO_T_ family, stays defined even after its
  268.    corresponding type is defined).  If we define wchar_t, then we
  269.    must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
  270.    we undef _WCHAR_T_, then we must also define rune_t, since 
  271.    headers like runetype.h assume that if machine/ansi.h is included,
  272.    and _BSD_WCHAR_T_ is not defined, then rune_t is available.
  273.    machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
  274.    the same type." */
  275. #ifdef _BSD_WCHAR_T_
  276. #undef _BSD_WCHAR_T_
  277. #ifdef _BSD_RUNE_T_
  278. #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
  279. typedef _BSD_RUNE_T_ rune_t;
  280. #define _BSD_WCHAR_T_DEFINED_
  281. #if defined (__FreeBSD__)
  282. /* Why is this file so hard to maintain properly?  In constrast to
  283.    the comment above regarding BSD/386 1.1, on FreeBSD for as long
  284.    as the symbol has existed, _BSD_RUNE_T_ must not stay defined or
  285.    redundant typedefs will occur when stdlib.h is included after this file. */
  286. #undef _BSD_RUNE_T_
  287. #endif
  288. #endif
  289. #endif
  290. #endif
  291.  
  292. #ifndef __WCHAR_TYPE__
  293. #define __WCHAR_TYPE__ int
  294. #endif
  295. #ifndef __cplusplus
  296. typedef __WCHAR_TYPE__ wchar_t;
  297. #endif
  298. #endif
  299. #endif
  300. #endif
  301. #endif
  302. #endif
  303. #endif
  304. #endif
  305. #endif
  306. #endif
  307. #endif
  308. #endif
  309. #endif
  310. #endif
  311. #endif /* __WCHAR_T__ */
  312. #endif /* __wchar_t__ */
  313. #undef    __need_wchar_t
  314. #endif /* _STDDEF_H or __need_wchar_t.  */
  315.  
  316. #if defined (__need_wint_t)
  317. #ifndef _WINT_T
  318. #define _WINT_T
  319.  
  320. #ifndef __WINT_TYPE__
  321. #define __WINT_TYPE__ unsigned int
  322. #endif
  323. typedef __WINT_TYPE__ wint_t;
  324. #endif
  325. #undef __need_wint_t
  326. #endif
  327.  
  328. /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
  329.     are already defined.  */
  330. /*  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.  */
  331. #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
  332. /*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
  333.     are probably typos and should be removed before 2.8 is released.  */
  334. #ifdef _GCC_PTRDIFF_T_
  335. #undef _PTRDIFF_T_
  336. #undef _BSD_PTRDIFF_T_
  337. #endif
  338. #ifdef _GCC_SIZE_T_
  339. #undef _SIZE_T_
  340. #undef _BSD_SIZE_T_
  341. #endif
  342. #ifdef _GCC_WCHAR_T_
  343. #undef _WCHAR_T_
  344. #undef _BSD_WCHAR_T_
  345. #endif
  346. /*  The following ones are the real ones.  */
  347. #ifdef _GCC_PTRDIFF_T
  348. #undef _PTRDIFF_T_
  349. #undef _BSD_PTRDIFF_T_
  350. #endif
  351. #ifdef _GCC_SIZE_T
  352. #undef _SIZE_T_
  353. #undef _BSD_SIZE_T_
  354. #endif
  355. #ifdef _GCC_WCHAR_T
  356. #undef _WCHAR_T_
  357. #undef _BSD_WCHAR_T_
  358. #endif
  359. #endif /* _ANSI_H_ || _MACHINE_ANSI_H_ */
  360.  
  361. #endif /* __sys_stdtypes_h */
  362.  
  363. /* A null pointer constant.  */
  364.  
  365. #if defined (_STDDEF_H) || defined (__need_NULL)
  366. #undef NULL        /* in case <stdio.h> has defined it. */
  367. #ifdef __GNUG__
  368. #define NULL __null
  369. #else   /* G++ */
  370. #ifndef __cplusplus
  371. #define NULL ((void *)0)
  372. #else   /* C++ */
  373. #define NULL 0
  374. #endif  /* C++ */
  375. #endif  /* G++ */
  376. #endif    /* NULL not defined and <stddef.h> or need NULL.  */
  377. #undef    __need_NULL
  378.  
  379. #ifdef _STDDEF_H
  380.  
  381. /* Offset of member MEMBER in a struct of type TYPE.  */
  382.  
  383. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  384.  
  385. #endif /* _STDDEF_H was defined this time */
  386.  
  387. #endif /* not RC_INVOKED */
  388. #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
  389.       || __need_XXX was not defined before */
  390.